package com.edu.chat.web.controller;

import com.edu.chat.web.common.model.R;
import com.edu.chat.web.controller.vo.PageQuery;
import com.edu.chat.web.controller.vo.QuerySceneVO;
import com.edu.chat.web.controller.vo.SceneVO;
import com.edu.chat.web.service.CsSceneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: KQAIA
 * @description: 聊天窗管理
 * @author: 无恙
 * @create: 2025-04-05 22:36
 **/

@RestController
@RequestMapping("/chat/scene")
@Slf4j
public class    SceneController {

	@Autowired
	private CsSceneService csSceneService;

	/*
	* @author 范铁凝
	* @date 2025/4/5
	* 新建聊天窗
	 */
	@PostMapping(value = "/create")
	public R<?> createScene(@RequestBody @Validated SceneVO sceneVO) {
		return csSceneService.createScene(sceneVO);
	}

	/*
	* @author 范铁凝
	* @date 2025/4/6
	* 分页查询聊天窗
	*/
	@PostMapping(value = "/list")
	public R<?> listScene(@RequestBody PageQuery<QuerySceneVO> sceneVOPageQuery) {
		return R.success(csSceneService.querySceneList(sceneVOPageQuery));
	}

	/*
	* @author 范铁凝
	* @date 2025/4/6
	* 删除聊天窗
	*/
	@PostMapping(value = "/delete")
	public R<?> deleteScene(@RequestBody Long id) {
		return R.success(csSceneService.removeById(id));
	}

	/*
	* @author 范铁凝
	* @date 2025/4/6
	* 更新聊天窗
	*/
	@PostMapping(value = "/update")
	public R<?> updateScene(@RequestBody SceneVO sceneVO) {
		return R.success(csSceneService.updateScene(sceneVO));
	}

}
